<template>
  <!-- 商家列表部分 -->
    <div class="business" @click="navigatorToBusinessInfo(business.businessId)">
        <div class="businessItem">
            <div class="businessImg">
                <img :src=business.businessImg>
            </div>
            <div class="business-info">
                <h3>{{business.businessName}}</h3>
                <p>&#165;{{ business.starPrice }}| &#165;{{ business.deliveryPrice }}配送</p>
                <p>{{business.businessExplain}}</p>
            </div>
        </div>
    </div>
</template>

<script setup>
import router from "../route/route.js";
import {toRefs} from "vue";

const props = defineProps(["business"])
const {business} = toRefs(props)
const navigatorToBusinessInfo = (businessId)=>{
    router.push({path:`/BusinessInfo/${businessId}`})
}
</script>

<style scoped>
/****************** 商家列表部分 ******************/
.business{
    width: 100%;
    margin-top: 12vw;
    margin-bottom: 14vw;
}
.business .businessItem{
    width: 100%;
    box-sizing: border-box;
    padding: 2.5vw;
    border-bottom: solid 1px #DDD;
    user-select: none;
    cursor: pointer;

    display: flex;
    align-items: center;
}
.business .businessItem .businessImg{
    /*这里设置为相当定位，成为businessImgQuantity元素的父元素*/
    position: relative;
}
.business .businessItem .businessImg img{
    width: 20vw;
    height: 20vw;
}
.business .businessItem .businessImg .businessImgQuantity{
    width: 5vw;
    height: 5vw;
    background-color: red;
    color: #fff;
    font-size: 3.6vw;
    border-radius: 2.5vw;

    display: flex;
    justify-content: center;
    align-items: center;

    /*设置成绝对定位，不占文档流空间*/
    position: absolute;
    right: -1.5vw;
    top: -1.5vw;
}
.business .businessItem .business-info{
    margin-left: 3vw;
}
.business .businessItem .business-info h3{
    font-size: 3.8vw;
    color: #555;
}
.business .businessItem .business-info p{
    font-size: 3vw;
    color: #888;
    margin-top: 2vw;
}
</style>